<template>
    <div>
        <h1>投资显示</h1>
        投资名称:<input type="text" v-model="name" />
        投资总金额:<input type="text" v-model="money1" />-
        <input type="text" v-model="money2" />
        <button class="btn btn-primary" @click="Show()">查询</button>
        <table class="table" border="1">
            <thead>
                <tr>
                    <th>投资名称</th>
                    <th>投资总额度</th>
                    <th>已投资额度</th>
                    <th>剩余额度</th>
                    <th>投资人数</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <tr v-for="item in info" :key="item.Iid" >
                    <td>{{ item.Iname}}</td>
                    <td>{{ item.Iall }}</td>
                    <td>{{ item.Iank}}</td>
                    <td>{{ item.Iout}}</td>
                    <td>{{ item.Inum}}</td>
                    <td>
                       <button class="btn btn-primary">修改</button>
                       <button class="btn btn-primary">删除</button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>
<script setup lang="ts">
import axios from 'axios';
import { ref,onMounted } from 'vue';


const name = ref('')
const money1 = ref('')
const money2 = ref('')

const info :any= ref([])

onMounted(()=>{
    Show();
})

const Show=()=>{
    axios({
        method:'get',
        url:'http://localhost:55574/api/End/InvestShow',
        params:{
            name:name.value,
            money1:money1.value,
            money2:money2.value
        }
    })
    .then((res)=>{
        console.log(res.data)
        info.value=res.data
    })
    .catch((err)=>{
        console.log(err)
    })
}
</script>